﻿Imports Training.Common

Partial Public Class _Default
    Inherits System.Web.UI.Page
    Dim gid As Integer ' groupid

    ''' <summary>
    ''' Page Load events
    ''' </summary>
    ''' <param name="sender"></param>
    ''' <param name="e"></param>
    ''' <remarks>redirect user based on role</remarks>
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim usr As MembershipUser = Membership.GetUser()
        ' check for roles
        If User.IsInRole("group") Then
            ' get group id
            gid = GetGroupIDByUserID(usr.ProviderUserKey.ToString)
            Response.Redirect("CreateUserAccount.aspx?gid=" & gid)
        End If

        If User.IsInRole("user") Then
            Response.Redirect("Training.aspx")
        End If

        If User.IsInRole("administrator") Or User.IsInRole("superadmin") Then
            Response.Redirect("admin/default.aspx")
        End If
    End Sub

End Class